/* GUI CONVERTED from reworka.p (converter v1.75) Sat Aug 12 23:11:06 2000 */
/* reworka.p - REPETITIVE                                                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                         */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                       */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 7.4      LAST MODIFIED: 08/25/97   BY: Todd Runkle *H1DL*        */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/25/99   BY: *N002* Bill Gates         */
/* REVISION: 9.1      LAST MODIFIED: 11/17/99   BY: *N04H* Vivek Gogte        */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */


/* REWORK TRANSACTION POST REWORK QTY SUBPROGRAM                              */

          {mfdeclre.i}

          define input parameter cumwo_lot as character no-undo.
          define input parameter op as integer no-undo.
          define input parameter to_op as integer no-undo.
          define input parameter rsn_code as character no-undo.
          define input parameter ophist_recid as recid no-undo.
          define input parameter qty_rework as decimal no-undo.

/*N04H**  {rewrsdef.i}                                                        */

          if qty_rework = 0 then return.

          /*NO TRANSACTION SHOULD BE PENDING HERE*/
/*H1DL*         {gprun.i ""gpistran.p"" "(input 1, input """")} */
/*N002 /*H1DL*/ {gprun.i ""gpistran.p"" "(input 1, input """")"} */

          do trans:
/*GUI*/ if global-beam-me-up then undo, leave.

             find wr_route where wr_lot = cumwo_lot and
                                 wr_op = op exclusive-lock.

/*N04H**     {rewrsget.i &lot=wr_lot &op=wr_op &lock=exclusive-lock}          */

             wr_qty_rejque = wr_qty_rejque - qty_rework.
             wr_qty_outque = wr_qty_outque + qty_rework.
             wr_qty_cumrwrk = wr_qty_cumrwrk + qty_rework.

/*N04H**     {rewrsput.i &lot=wr_lot &op=wr_op}                               */

             find op_hist where recid(op_hist) = ophist_recid exclusive-lock.
             op_qty_rwrk = qty_rework.
             op_rsn_rwrk = rsn_code.
             op__chr03 = string(to_op).

             /*UPDATE REPETITIVE SCHEDULE*/
             {gprun.i ""reupdsch.p""
             "(input cumwo_lot, input op, input qty_rework)"}
/*GUI*/ if global-beam-me-up then undo, leave.

          end.
/*GUI*/ if global-beam-me-up then undo, leave.

